package com.yyjj.hangqing.adapter;

import android.os.Bundle;
import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yyjj.hangqing.R;
import com.yyjj.hangqing.entity.ZhiShuBaoEntity;

import tech.com.commoncore.utils.OnNoDoubleClickListener;


public class ZhiShuBaoAdapter extends BaseQuickAdapter<ZhiShuBaoEntity, BaseViewHolder> {

    public ZhiShuBaoAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, final ZhiShuBaoEntity item) {

            helper.setText(R.id.tv_name, item.getName());
            helper.setText(R.id.tv_date, item.getPrevsettlement());

            helper.setText(R.id.tv_code, item.getSymbol());
            if (item.getMonth() == null || item.getMonth() == "") {
                helper.setText(R.id.tv_percent, "0.00%");
            } else {
                helper.setText(R.id.tv_percent, item.getMonth());
            }

        helper.itemView.setOnClickListener(new OnNoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                        Bundle bundle = new Bundle();
                        bundle.putString("symbol",item.getSymbol());
                        ARouter.getInstance().build("/hq/ZhiShuBaoDetail").with(bundle).navigation();
            }
        });


    }
}
